Fix breakage of blktap device strings from cset 63d1b02dad347e8feb845d8a8b482e251a478164.
authorAndrew Warfield <andy@xensource.com>
Tue, 14 Nov 2006 19:20:45 +0000 (11:20 -0800)
committerAndrew Warfield <andy@xensource.com>
Tue, 14 Nov 2006 19:20:45 +0000 (11:20 -0800)
Signed-off-by: Andrew Warfield <andy@xensource.com>
tools/python/xen/util/security.py

index 91c0badd74350c6e31e33f18301c12b70733f16e..9957e7f58658a6bb55f349fc632e713c7c3108b8 100644 (file)
@@ -606,11 +606,17 @@ def unify_resname(resource):
 
     # sanity check on resource name
     try:
-        (type, resfile) = resource.split(":")
+        (type, resfile) = resource.split(":", 1)
     except:
         err("Resource spec '%s' contains no ':' delimiter" % resource)
 
-    if type == "phy":
+    if type == "tap":
+        try:
+            (subtype, resfile) = resfile.split(":")
+        except:
+            err("Resource spec '%s' contains no tap subtype" % resource)
+
+    if type in ["phy", "tap"]:
         if not resfile.startswith("/"):
             resfile = "/dev/" + resfile
 
@@ -619,6 +625,8 @@ def unify_resname(resource):
         err("Invalid resource.")
 
     # from here on absolute file names with resources
+    if type == "tap":
+        type = type + ":" + subtype
     resource = type + ":" + resfile
     return resource